package com.pubinfo.passbook.common.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * null
 *
 * @TableName t_system_task_log
 */
@TableName(value = "t_task_log")
@Data
@NoArgsConstructor
@ApiModel(value = "TTaskLog", description = "任务日志")
public class TTaskLog implements Serializable {
  /**
   *
   */
//  @TableId(type = IdType.INPUT)
  @TableId
  private String id;
  @Version
  private Long version;
  /**
   * 同步日期
   */
  @ApiModelProperty(value = "同步开始日期")
  @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
  private Date startDate;
  
  /**
   * 同步日期
   */
  @ApiModelProperty(value = "同步结束日期")
  @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
  private Date endDate;
  /**
   * 接收总条数
   */
  @ApiModelProperty(value = "接收总条数")
  private Integer acceptTotalCount;
  
  @ApiModelProperty(value = "主体名称")
  private String name;
  /**
   *
   */
  @ApiModelProperty(value = "成功总条数")
  private Integer successCount;
  
  @ApiModelProperty(value = "状态")
  private Integer status;
  /**
   *
   */
  @ApiModelProperty(value = "创建时间")
  @TableField(fill = FieldFill.INSERT)
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  private Date createTime;
  
  @ApiModelProperty(value = "总响应时间 单位:毫秒")
  private Long responseTime;
  /**
   *
   */
  @ApiModelProperty(value = "任务id")
  private String taskId;
  
  @TableField(exist = false)
  private static final long serialVersionUID = 1L;
  
  
  @SneakyThrows
  public TTaskLog(String startDate, String endDate) {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
    Date start = sdf.parse(startDate);
    Date end = sdf.parse(endDate);
    this.startDate = start;
    this.endDate = end;
  }
}